package com.dronff.gvm.utils;

import com.dronff.gvm.entity.Klass;
import com.dronff.gvm.interfaces.ReadFunction;
import com.dronff.gvm.memorymanager.impl.MiniMemoryImpl;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.Arrays;

/**
 * @author: tyf
 * @date: 2022/9/9 20:55
 * @description: todo(解析内存
 */
@Deprecated
public class MemoryParserUtils {
    public static void memory2Klass(MiniMemoryImpl memory) throws IOException {
//        Klass klass = new Klass();
//        // 这需要先把内存拷贝一遍
//        DataInputStream dis = memory.readOnly(data -> new DataInputStream(new ByteArrayInputStream(data)));
//        int nameLength = dis.readUnsignedShort();
//        byte[] nameBytes = new byte[nameLength];
//        dis.read(nameBytes);
//        return klass.setName(new String(nameBytes));
    }
}
